import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutterapp1/Base/BaseWidget/BaseWidget.dart';
import 'package:flutterapp1/color/MyColor.dart';
import 'ATHomeWidget.dart';
import 'package:flutterapp1/view/AppNavi.dart';
class HomeContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
      ),
      home:ATHomeContentWidget(title: "首页",),
    );
  }
}
class ATHomeContentWidget extends BaseStatefulWidget{
  ATHomeContentWidget({Key key, this.title}) : super(key: key);
  final String title;
  @override
  State<StatefulWidget> createState() {
    return HomeContentCtrlState();
  }
}
class HomeContentCtrlState extends State<ATHomeContentWidget> with SingleTickerProviderStateMixin {
  TabController tabController;
  List <Widget>listTitle = [Tab(text: '男生',),Tab(text: '女生',),Tab(text: '综合',),Tab(text:"出版社")];
  List <Widget>listData  = [ATHomeStatefulWidget(title:"",male: "male",),ATHomeStatefulWidget(title:"",male:"female"),ATHomeStatefulWidget(title:"",male: "picture",),ATHomeStatefulWidget(title:"",male: "press",)];
  @override
  void initState() {
    super.initState();
    this.tabController = TabController(length: this.listData.length,vsync: this);
  }
  @override
  Widget build(BuildContext context) {
    // TODO: implement build

    return Scaffold(
      appBar: new AppHomeNavi(
        title: Row(
          children: <Widget>[
            Expanded(
              child: TabBar(
                labelColor: MyColor.AppFFFFFF,
                unselectedLabelColor: MyColor.App000000,
                controller: this.tabController,
                tabs: this.listTitle,
                labelPadding: EdgeInsets.only(top:0),
                indicatorColor: MyColor.AppFFFFFF,
                indicatorSize:TabBarIndicatorSize.label ,
              ),
            ),
          ],
        ),
      ),
//      appBar: TabBar(
//        labelColor: MyColor.AppColor,
//        unselectedLabelColor: MyColor.AppRed,
//        controller: this.tabController,
//        tabs: this.listTitle,
//        labelPadding: EdgeInsets.only(top:(AppStatusBar)),
//        indicatorColor: MyColor.AppRed,
//        indicatorSize:TabBarIndicatorSize.label ,
//
//      ),
      body: TabBarView(
        controller: this.tabController,
        children: this.listData,
      ),
    );
  }
}
